home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.earthlink.net!usenet
- From: rec@elf115.elf.org (Roger E. Critchlow Jr.)
- Newsgroups: comp.lang.tcl,comp.lang.c,comp.os.linux.development.system
- Subject: Re: How do I get a (FILE *) from file descriptor?
- Followup-To: comp.lang.tcl
- Date: 16 Apr 1996 13:05:37 -0700
- Organization: entropy liberation front
- Sender: rec@elf115.elf.org
- Message-ID: <55ybnworxq.fsf@elf115.elf.org>
- References: <yvdohosur3f.fsf@i44sg1.info.uni-karlsruhe.de>
- NNTP-Posting-Host: elf115.elf.org
- In-reply-to: frick@i44sg1.informatik.uni-karlsruhe.de's message of 16 Apr 1996
- 17:27:18 +0200
- X-Newsreader: Gnus v5.1
-
- frick@i44sg1.informatik.uni-karlsruhe.de (Arne K. Frick) writes:
-
- Background: A Tcl extension I use depends on using the (FILE *) form for
- describing its file handles. However, in Tcl-7.5b3 J. Ousterhout dropped
- support for the UNIX-specific command 'Tcl_GetOpenFile' which would take a
- Tcl handle and return the associated (FILE *). Now, all there is is a set
- of functions ultimately giving me an (int) as a file descriptor.
-
- Relax, Tcl_GetOpenFile() is back in the final release of tcl7.5.
-
- -- rec --
-
-
- Tcl_GetOpenFile(3) Tcl Library Procedures Tcl_GetOpenFile(3)
-
- _________________________________________________________________
-
- NAME
- Tcl_GetOpenFile - Get a standard IO File * handle from a
- channel.
-
- SYNOPSIS
- #include <tcl.h>
-
- int
- Tcl_GetOpenFile(interp, string, write, checkUsage, filePtr)
-
- ARGUMENTS
- Tcl_Interp *interp (in) Tcl interpreter from
- which file handle is
- to be obtained.
-
- char *string (in) String identifying
- channel, such as stdin
- or file4.
-
- int write (in) Non-zero means the
- file will be used for
- writing, zero means it
- will be used for read-
- ing.
-
- int checkUsage (in) If non-zero, then an
- error will be gener-
- ated if the file
- wasn't opened for the
- access indicated by
- write.
-
- ClientData *filePtr (out) Points to word in
- which to store pointer
- to FILE structure for
- the file given by
- string.
- _________________________________________________________________
-
- DESCRIPTION
- Tcl_GetOpenFile takes as argument a file identifier of the
- form returned by the open command and returns at *filePtr
- a pointer to the FILE structure for the file. The write
- argument indicates whether the FILE pointer will be used
- for reading or writing. In some cases, such as a channel
- that connects to a pipeline of subprocesses, different
- FILE pointers will be returned for reading and writing.
- Tcl_GetOpenFile normally returns TCL_OK. If an error
- occurs in Tcl_GetOpenFile (e.g. string didn't make any
- sense or checkUsage was set and the file wasn't opened for
- the access specified by write) then TCL_ERROR is returned
- and interp->result will contain an error message. In the
- current implementation checkUsage is ignored and consis-
- tency checks are always performed.
-
- KEYWORDS
- channel, file handle, permissions, pipeline, read, write
-
- Tcl 7.5 2
-